{"ast":null,"code":"import _toConsumableArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _slicedToArray from \"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nvar _excluded = [\"boundaryCount\", \"componentName\", \"count\", \"defaultPage\", \"disabled\", \"hideNextButton\", \"hidePrevButton\", \"onChange\", \"page\", \"showFirstButton\", \"showLastButton\", \"siblingCount\"];\nimport { unstable_useControlled as useControlled } from '@mui/utils';\nexport default function usePagination() {\n  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  // keep default values in sync with @default tags in Pagination.propTypes\n  var _props$boundaryCount = props.boundaryCount,\n    boundaryCount = _props$boundaryCount === void 0 ? 1 : _props$boundaryCount,\n    _props$componentName = props.componentName,\n    componentName = _props$componentName === void 0 ? 'usePagination' : _props$componentName,\n    _props$count = props.count,\n    count = _props$count === void 0 ? 1 : _props$count,\n    _props$defaultPage = props.defaultPage,\n    defaultPage = _props$defaultPage === void 0 ? 1 : _props$defaultPage,\n    _props$disabled = props.disabled,\n    disabled = _props$disabled === void 0 ? false : _props$disabled,\n    _props$hideNextButton = props.hideNextButton,\n    hideNextButton = _props$hideNextButton === void 0 ? false : _props$hideNextButton,\n    _props$hidePrevButton = props.hidePrevButton,\n    hidePrevButton = _props$hidePrevButton === void 0 ? false : _props$hidePrevButton,\n    handleChange = props.onChange,\n    pageProp = props.page,\n    _props$showFirstButto = props.showFirstButton,\n    showFirstButton = _props$showFirstButto === void 0 ? false : _props$showFirstButto,\n    _props$showLastButton = props.showLastButton,\n    showLastButton = _props$showLastButton === void 0 ? false : _props$showLastButton,\n    _props$siblingCount = props.siblingCount,\n    siblingCount = _props$siblingCount === void 0 ? 1 : _props$siblingCount,\n    other = _objectWithoutPropertiesLoose(props, _excluded);\n  var _useControlled = useControlled({\n      controlled: pageProp,\n      default: defaultPage,\n      name: componentName,\n      state: 'page'\n    }),\n    _useControlled2 = _slicedToArray(_useControlled, 2),\n    page = _useControlled2[0],\n    setPageState = _useControlled2[1];\n  var handleClick = function handleClick(event, value) {\n    if (!pageProp) {\n      setPageState(value);\n    }\n    if (handleChange) {\n      handleChange(event, value);\n    }\n  }; // https://dev.to/namirsab/comment/2050\n\n  var range = function range(start, end) {\n    var length = end - start + 1;\n    return Array.from({\n      length: length\n    }, function (_, i) {\n      return start + i;\n    });\n  };\n  var startPages = range(1, Math.min(boundaryCount, count));\n  var endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);\n  var siblingsStart = Math.max(Math.min(\n  // Natural start\n  page - siblingCount,\n  // Lower boundary when page is high\n  count - boundaryCount - siblingCount * 2 - 1),\n  // Greater than startPages\n  boundaryCount + 2);\n  var siblingsEnd = Math.min(Math.max(\n  // Natural end\n  page + siblingCount,\n  // Upper boundary when page is low\n  boundaryCount + siblingCount * 2 + 2),\n  // Less than endPages\n  endPages.length > 0 ? endPages[0] - 2 : count - 1); // Basic list of items to render\n  // e.g. itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']\n\n  var itemList = [].concat(_toConsumableArray(showFirstButton ? ['first'] : []), _toConsumableArray(hidePrevButton ? [] : ['previous']), _toConsumableArray(startPages), _toConsumableArray(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : []), _toConsumableArray(range(siblingsStart, siblingsEnd)), _toConsumableArray(siblingsEnd < count - boundaryCount - 1 ? ['end-ellipsis'] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : []), _toConsumableArray(endPages), _toConsumableArray(hideNextButton ? [] : ['next']), _toConsumableArray(showLastButton ? ['last'] : [])); // Map the button type to its page number\n\n  var buttonPage = function buttonPage(type) {\n    switch (type) {\n      case 'first':\n        return 1;\n      case 'previous':\n        return page - 1;\n      case 'next':\n        return page + 1;\n      case 'last':\n        return count;\n      default:\n        return null;\n    }\n  }; // Convert the basic item list to PaginationItem props objects\n\n  var items = itemList.map(function (item) {\n    return typeof item === 'number' ? {\n      onClick: function onClick(event) {\n        handleClick(event, item);\n      },\n      type: 'page',\n      page: item,\n      selected: item === page,\n      disabled: disabled,\n      'aria-current': item === page ? 'true' : undefined\n    } : {\n      onClick: function onClick(event) {\n        handleClick(event, buttonPage(item));\n      },\n      type: item,\n      page: buttonPage(item),\n      selected: false,\n      disabled: disabled || item.indexOf('ellipsis') === -1 && (item === 'next' || item === 'last' ? page >= count : page <= 1)\n    };\n  });\n  return _extends({\n    items: items\n  }, other);\n}","map":{"version":3,"names":["_extends","_objectWithoutPropertiesLoose","_excluded","unstable_useControlled","useControlled","usePagination","props","boundaryCount","componentName","count","defaultPage","disabled","hideNextButton","hidePrevButton","handleChange","onChange","pageProp","page","showFirstButton","showLastButton","siblingCount","other","controlled","default","name","state","setPageState","handleClick","event","value","range","start","end","length","Array","from","_","i","startPages","Math","min","endPages","max","siblingsStart","siblingsEnd","itemList","buttonPage","type","items","map","item","onClick","selected","undefined","indexOf"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@mui/material/esm/usePagination/usePagination.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"boundaryCount\", \"componentName\", \"count\", \"defaultPage\", \"disabled\", \"hideNextButton\", \"hidePrevButton\", \"onChange\", \"page\", \"showFirstButton\", \"showLastButton\", \"siblingCount\"];\nimport { unstable_useControlled as useControlled } from '@mui/utils';\nexport default function usePagination(props = {}) {\n  // keep default values in sync with @default tags in Pagination.propTypes\n  const {\n    boundaryCount = 1,\n    componentName = 'usePagination',\n    count = 1,\n    defaultPage = 1,\n    disabled = false,\n    hideNextButton = false,\n    hidePrevButton = false,\n    onChange: handleChange,\n    page: pageProp,\n    showFirstButton = false,\n    showLastButton = false,\n    siblingCount = 1\n  } = props,\n        other = _objectWithoutPropertiesLoose(props, _excluded);\n\n  const [page, setPageState] = useControlled({\n    controlled: pageProp,\n    default: defaultPage,\n    name: componentName,\n    state: 'page'\n  });\n\n  const handleClick = (event, value) => {\n    if (!pageProp) {\n      setPageState(value);\n    }\n\n    if (handleChange) {\n      handleChange(event, value);\n    }\n  }; // https://dev.to/namirsab/comment/2050\n\n\n  const range = (start, end) => {\n    const length = end - start + 1;\n    return Array.from({\n      length\n    }, (_, i) => start + i);\n  };\n\n  const startPages = range(1, Math.min(boundaryCount, count));\n  const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count);\n  const siblingsStart = Math.max(Math.min( // Natural start\n  page - siblingCount, // Lower boundary when page is high\n  count - boundaryCount - siblingCount * 2 - 1), // Greater than startPages\n  boundaryCount + 2);\n  const siblingsEnd = Math.min(Math.max( // Natural end\n  page + siblingCount, // Upper boundary when page is low\n  boundaryCount + siblingCount * 2 + 2), // Less than endPages\n  endPages.length > 0 ? endPages[0] - 2 : count - 1); // Basic list of items to render\n  // e.g. itemList = ['first', 'previous', 1, 'ellipsis', 4, 5, 6, 'ellipsis', 10, 'next', 'last']\n\n  const itemList = [...(showFirstButton ? ['first'] : []), ...(hidePrevButton ? [] : ['previous']), ...startPages, // Start ellipsis\n  // eslint-disable-next-line no-nested-ternary\n  ...(siblingsStart > boundaryCount + 2 ? ['start-ellipsis'] : boundaryCount + 1 < count - boundaryCount ? [boundaryCount + 1] : []), // Sibling pages\n  ...range(siblingsStart, siblingsEnd), // End ellipsis\n  // eslint-disable-next-line no-nested-ternary\n  ...(siblingsEnd < count - boundaryCount - 1 ? ['end-ellipsis'] : count - boundaryCount > boundaryCount ? [count - boundaryCount] : []), ...endPages, ...(hideNextButton ? [] : ['next']), ...(showLastButton ? ['last'] : [])]; // Map the button type to its page number\n\n  const buttonPage = type => {\n    switch (type) {\n      case 'first':\n        return 1;\n\n      case 'previous':\n        return page - 1;\n\n      case 'next':\n        return page + 1;\n\n      case 'last':\n        return count;\n\n      default:\n        return null;\n    }\n  }; // Convert the basic item list to PaginationItem props objects\n\n\n  const items = itemList.map(item => {\n    return typeof item === 'number' ? {\n      onClick: event => {\n        handleClick(event, item);\n      },\n      type: 'page',\n      page: item,\n      selected: item === page,\n      disabled,\n      'aria-current': item === page ? 'true' : undefined\n    } : {\n      onClick: event => {\n        handleClick(event, buttonPage(item));\n      },\n      type: item,\n      page: buttonPage(item),\n      selected: false,\n      disabled: disabled || item.indexOf('ellipsis') === -1 && (item === 'next' || item === 'last' ? page >= count : page <= 1)\n    };\n  });\n  return _extends({\n    items\n  }, other);\n}"],"mappings":";;AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,6BAA6B,MAAM,yDAAyD;AACnG,IAAMC,SAAS,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,CAAC;AACrM,SAASC,sBAAsB,IAAIC,aAAa,QAAQ,YAAY;AACpE,eAAe,SAASC,aAAa,GAAa;EAAA,IAAZC,KAAK,uEAAG,CAAC,CAAC;EAC9C;EACA,2BAaIA,KAAK,CAZPC,aAAa;IAAbA,aAAa,qCAAG,CAAC;IAAA,uBAYfD,KAAK,CAXPE,aAAa;IAAbA,aAAa,qCAAG,eAAe;IAAA,eAW7BF,KAAK,CAVPG,KAAK;IAALA,KAAK,6BAAG,CAAC;IAAA,qBAUPH,KAAK,CATPI,WAAW;IAAXA,WAAW,mCAAG,CAAC;IAAA,kBASbJ,KAAK,CARPK,QAAQ;IAARA,QAAQ,gCAAG,KAAK;IAAA,wBAQdL,KAAK,CAPPM,cAAc;IAAdA,cAAc,sCAAG,KAAK;IAAA,wBAOpBN,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